<template>
  <el-select :value="value" placeholder="请选择频道" clearable @change="onChange">
    <el-option v-for="item in channels" :key="item.id" :label="item.name" :value="item.id"></el-option>
  </el-select>
</template>

<script>
import { getChannelList } from '@/api/article'
export default {
  props: ['value'],
  data () {
    return {
      channels: []
    }
  },
  created () {
    this.getChannels()
  },
  methods: {
    getChannels () {
      getChannelList().then(res => {
        console.log(res)
        this.channels = res.data.channels
      })
    },
    onChange (value) {
      console.log(value)
      this.$emit('input', value)
    }
  }
}
</script>

<style>

</style>
